package org.lc.service.system.feign;


import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.lc.platform.base.result.Result;
import org.lc.service.system.entity.SysMenu;
import org.lc.service.system.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/feign/menu")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@Tag(name = "MenuFeign|提供微服务调用接口")
@Hidden()
@RefreshScope
public class MenuFeign {
    private final SysMenuService menuService;

    @GetMapping(value = "/complete/menu")
    @Operation(summary = "通过客户端ID获取完整的前端路由")
    public Result<List<SysMenu>> getMenuTreeList(@RequestParam("clientId") String clientId) {
        return Result.data(menuService.getMenuTreeList());
    }
}
